﻿@model IEnumerable<MsForgeReboot.Framework.ViewModels.SectionListViewModel>

@{
    ViewBag.Title = "Meni i strane";
}
@Scripts.Render("~/bundles/controlpanel/sections")
@Styles.Render("~/Content/themes/base/css")

<script>
    $(document).ready(function () {
        window.cms.wireup();
    });
</script>
<style>
    input.section {
        font-size: 11px;
        font-weight: bold;
        width: 50px;
        border: 1px solid silver;
        margin: 0px;
    }
    body .modal     {
        width: 50%;
        left: 33%;
        margin: auto, auto, auto, auto;
    }


</style>

<h2>@ViewBag.Title</h2>

<p><a href="#" id="sectionToggle" class="btn btn-primary">Dodaj novu sekciju <i class="icon-plus-sign"></i></a></p>
<div id="sectionAddContainer" style="display: none">
    <form name="sectionAddForm" id="sectionAddForm" method="POST" action="@Url.Action("Create")">
        <input type="text" name="model.Title" placeholder="Naslov..."/> 
        <input type="text" name="model.Order" placeholder="Redosled..."/>
        <input type="text" name="model.UrlPointer" placeholder="URL ka strani..."/><br/>
        <button class="btn btn-primary">Dodaj <i class="icon-save"></i></button>
    </form>
</div>
<h3>Sekcije u bazi</h3>
<table>
    <tr>
        <th></th>
        <th>
            @Html.DisplayNameFor(model => model.Title)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Order)
        </th>
        <th>@Html.DisplayNameFor(model => model.Url)</th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td><a href="#" class="addPageLink btn btn-small" data-id="@item.ID"><i class="@(item.HasPage ? "icon-file" : "icon-plus-sign")"></i></a>
        <td data-id="@item.ID" data-name="Title">
            @Html.DisplayFor(modelItem => item.Title)
        </td>
        <td data-id="@item.ID" data-name="Order">
            @Html.DisplayFor(modelItem => item.Order)
        </td>
        <td data-id="@item.ID" data-name="UrlPointer">
            @Html.DisplayFor(modelItem => item.Url)
        </td>
        <td class="btn-group">
            <a href="#" data-id="@item.ID" class="sectionEditLink btn btn-small">Menjaj <i class="icon-edit"></i></a>
            <a href="@Url.Action("Delete", "Cms", new { id = item.ID })" class="btn btn-danger btn-small">Briši <i class="icon-remove"></i></a>
        </td>
    </tr>
}

</table>
<div id="pageAddDialog" class="modal hide fade">
    <div class="modal-header"><h3>Dodaj stranu</h3></div>
    <div class="modal-body" id="pageBody">

    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal">Zatvori</button>
        <button class="btn btn-success" id="pageAddSubmit">Snimi <i class="icon-save"></i></button>
    </div>    
</div>

